﻿@using GoodMan.Infrastructure.Entities.Entity;
@using GoodMan.Infrastructure.Entities.Enum;
@{
    ViewBag.Title = "人员信息";
    Layout = "~/Areas/WorkSpace/Views/Shared/_AdminTemplete.cshtml";
    ItemListBox<User> list = ViewBag.UserList;
    List<Dormitory> dormitoryList = ViewBag.DormitoryList;
    GoodMan.Portal.Web.Areas.WorkSpace.Models.UserModel userModel = ViewBag.SearchModel;
}
    <link type="text/css" rel="Stylesheet" href="/content/css/select2.css" />
<div id="content-header">
    <h1>
        人员信息</h1>
</div>
<div id="breadcrumb">
    <a href="index.html" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>
        首页</a> <a href="/workspace/Admin/UserInfoList" class="tip-bottom">人员管理</a> <a href="/workspace/Admin/UserInfoList"
            class="current">信息列表</a>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-title">
                <h5>
                    信息列表</h5>
            </div>
            <form action="/workspace/admin/userinfolist" method="get" name="userForm">

            <div style="width: 30%; margin: 0px auto;">
                <table  border="0" cellpadding="0" cellspacing="0">
                    <tr align="center" style="height:60px;">
                        
                        <td width="10%">
                            角色
                        </td>
                        <td width="11%">
                            <select name="SystemRole" id="SystemRole" style="width: 150px;">
                                @{
                                    if (userModel.SystemRole == -2)
                                    {
                                    <option value="-2" selected="selected">全部</option>
                                    <option value="11">学校管理员</option>
                                    <option value="20">超级财务人员</option>
                                    }
                                    else if (userModel.SystemRole == 11)
                                    {
                                    
                                    <option value="-2">全部</option>
                                    <option value="11" selected="selected">学校管理员</option>
                                    <option value="20">超级财务人员</option>
                                    }
                                    else if (userModel.SystemRole == 20)
                                    {
                                    <option value="-2">全部</option>
                                    <option value="11">学校管理员</option>
                                    <option value="20" selected="selected">超级财务人员</option>

                                    }
                                }
                            </select>
                        </td>
                        
                       <td  colspan="2"  align="center">
                            <div style="width:100px; margin:0px auto"><button type="submit" class="btn btn-primary">
                                查询</button></div>
                        </td></tr>
                </table>
            </div>

            </form>
            <div class="widget-content nopadding">
                <table class="table table-bordered data-table">
                    <thead>
                        <tr>
                            <th>
                                用户名
                            </th>
                            <th width="15%">
                                昵称（真实姓名）
                            </th>
                            <th width="10%">
                                角色
                            </th>
                            <th width="3%">
                                性别
                            </th>
                            <th width="10%">
                                楼栋
                            </th>
                            <th width="5%">
                                寝室号
                            </th>
                            <th width="10%">
                                联系方式
                            </th>
                            <th width="5%">
                                是否禁用
                            </th>
                            <th width="20%">
                                操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            if (list != null && list.Data != null && list.Data.Count != 0)
                            {
                                int index = 0;
                                Dormitory dormitoryModel = new Dormitory();
                                foreach (var item in list.Data)
                                {
                                    index++;
                                    dormitoryModel = new Dormitory().Find(item.FloorId.ToString());
                            <tr class="gradeX" align="center">
                                <td>
                                    <a href="/workspace/admin/UserInfo?u=@item.UserName" title="查看详细">@item.UserName</a>
                                </td>
                                <td>@item.NickName (@item.RealName)
                                </td>
                                <td>@item.SystemRole.Mapping()
                                </td>
                                <td>@item.Gender.Mapping()
                                </td>
                                <td>
                                    @{
                                    if (dormitoryModel != null)
                                    {
                                        <span>
                                            @dormitoryModel.Name
                                        </span>
                                    }
                                    else
                                    {
                                        <span>--</span>
                                    }
                                    }
                                </td>
                                <td>@item.Dormitory
                                </td>
                                <td>
                                    QQ:@item.QQ
                                    <br />
                                    电话:@item.Phone
                                </td>
                                <td class="center">
                                    @{if (!item.IsRefuse)
                                      {
                                        <a class="btn btn-success btn-mini" href="/workspace/admin/modifystatu?u=@item.UserName&page=@list.CurrentPage&s=1" title="点击禁用">
                                            正常</a>}
                                      else
                                      {
                                        <a class="btn btn-danger btn-mini" href="/workspace/admin/modifystatu?u=@item.UserName&page=@list.CurrentPage&s=0" title="点击启用">
                                            禁用</a>}}
                                </td>
                                <td class="center">
                                    @{
                                      if (item.SystemRole.Mapping().Equals("学校管理员") || item.SystemRole.Mapping().Equals("超级财务管理员"))
                                      {
                                        <a href="/workspace/admin/modifypassword?u=@item.UserName&page=@list.CurrentPage" class="btn btn-primary btn-mini">
                                            改密</a> <a href="/workspace/admin/modifyuser?u=@item.UserName&page=@list.CurrentPage" class="btn btn-primary btn-mini">
                                                编辑</a> <a href="/workspace/admin/deluser?u=@item.UserName&page=@list.CurrentPage"  onclick="if (confirm('确认删除数据？删除后该数据无法恢复！')==true){return true;}else{return false;}"  class="btn btn-danger btn-mini">
                                                    删除</a>
                                      }
                                      else
                                      {
                                        <span>--</span>
                                      }
                                    }
                                </td>
                            </tr>
                                }

                            }
                            else
                            {
                            <tr class="gradeX">
                                <td style="width: 10px;" colspan="10" align="center">
                                    <span>没有找到任何数据</span>
                                </td>
                            </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
            @Html.Raw(list.PageItemSegment)
        </div>
    </div>
</div>
</div>
@section tail{
    <script type="text/javascript" src="/scripts/select2.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#likUser').addClass('open');
            $('#likUser').addClass('active');
            $('#CollegeId').each(function () {
                $(this).select2();
            });
            $('#FloorId').each(function () {
                $(this).select2();
            });
            $('#SystemRole').each(function () {
                $(this).select2();
            });
            $('#Gender').each(function () {
                $(this).select2();
            });
        });
    </script>
}
